/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.helpdesk.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Manuel
 */
@Entity
@Table(name = "hd_areas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HdAreas.findAll", query = "SELECT h FROM HdAreas h"),
    @NamedQuery(name = "HdAreas.findByCodArea", query = "SELECT h FROM HdAreas h WHERE h.codArea = :codArea"),
    @NamedQuery(name = "HdAreas.findByDesArea", query = "SELECT h FROM HdAreas h WHERE h.desArea = :desArea"),
    @NamedQuery(name = "HdAreas.findByIndEstadoAreas", query = "SELECT h FROM HdAreas h WHERE h.indEstadoAreas = :indEstadoAreas"),
    @NamedQuery(name = "HdAreas.findByAreaDesc", query = "SELECT h FROM HdAreas h WHERE h.desArea LIKE :desArea")})
public class HdAreas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.TABLE, generator="AREAS")
    @TableGenerator(name="AREAS", 
                    table="tbsequence",
                    pkColumnName="seq_name",
                    valueColumnName="seq_count")
    @Column(name = "COD_AREA", nullable=false)
    @Basic(optional = false)
    @NotNull
    private Integer codArea;
    @Size(max = 50)
    @Column(name = "DES_AREA")
    private String desArea;
    @Column(name = "IND_ESTADO_AREAS")
    private Character indEstadoAreas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codArea")
    private List<HdUsuarios> hdUsuariosList;

    public HdAreas() {
    }

    public HdAreas(Integer codArea) {
        this.codArea = codArea;
    }

    public Integer getCodArea() {
        return codArea;
    }

    public void setCodArea(Integer codArea) {
        this.codArea = codArea;
    }

    public String getDesArea() {
        return desArea;
    }

    public void setDesArea(String desArea) {
        this.desArea = desArea;
    }

    public Character getIndEstadoAreas() {
        return indEstadoAreas;
    }

    public void setIndEstadoAreas(Character indEstadoAreas) {
        this.indEstadoAreas = indEstadoAreas;
    }

    @XmlTransient
    public List<HdUsuarios> getHdUsuariosList() {
        return hdUsuariosList;
    }

    public void setHdUsuariosList(List<HdUsuarios> hdUsuariosList) {
        this.hdUsuariosList = hdUsuariosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codArea != null ? codArea.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HdAreas)) {
            return false;
        }
        HdAreas other = (HdAreas) object;
        if ((this.codArea == null && other.codArea != null) || (this.codArea != null && !this.codArea.equals(other.codArea))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
       // return "com.helpdesk.entidades.HdAreas[ codArea=" + codArea + " ]";
        return desArea;
    }
    
}
